#pragma once

#ifdef _DEBUG
#include <iostream>
using std::wcout;
using std::endl;
#endif

#if defined _M_IX86
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif

#ifdef _DEBUG
#include <iostream>
using std::wcout;
using std::endl;
#endif

#include <windows.h>
#include <vector>
#include <Shobjidl.h>
#include <string>
#include <map>
using std::map;
using std::wstring;
using std::vector;


namespace SubPlayer
{
    class FileOpener
    {
    public:
        FileOpener(map<wstring, wstring> fileTypeFilters);
        virtual ~FileOpener();
        HRESULT ShowDialog(wstring &filePath);
    private:
        HRESULT DialogEventHandler_CreateInstance(REFIID riid, void **ppv);
        COMDLG_FILTERSPEC* openTypes;
        int openTypesCount;
    };
    
    inline wstring returnPattern(wstring &type){return L"*." + type;}
    inline void CreatePattern(wstring &type){type = L"*." + type;}
    void CreatePattern(vector<wstring> &typesList);
    void CreatePattern(wstring *&typesArray, int arraySize);
    wstring GetExtension(const wstring &path);
}